﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="InputExamInfo.aspx.cs" Inherits="ExamAnalysis.Input.InputExamInfo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table border="0" width="800">
        <tr>
            <td>
                <img src="../Images/main/button-examinfo.jpg" />
            </td>
            <td>
                <ext:Panel runat="server" Height="200" Title="录入考试信息" Width="500">
                    <TopBar>
                        <ext:StatusBar StatusAlign="Left" runat="server">
                            <Items>
                                <ext:Label Text="上传文档：" runat="server"></ext:Label>
                                <ext:FileUploadField ID="FileField" runat="server" Width="250" Icon="Attach"   ButtonText="浏览"/>
                                <ext:Button ID="btnUpload" runat="server" Text="上传考试信息" OnDirectClick="btnUpload_DirectClick"></ext:Button>
                                <ext:Button ID="uploadExamItem" runat="server" Text="上传试题信息" OnDirectClick="uploadExamItem_DirectClick"></ext:Button>
                                <ext:ToolbarFill runat="server" />
                            </Items>
                        </ext:StatusBar>
                    </TopBar>
                    <Content>
                        <div style="padding:10px;">
                            <h3>上传说明：</h3>
                            <p>1.考题信息在“高级管理”中选择对应试题组后方能上传。</p>
                            <p>2.上传文件类型限制：Excel文档（.xls,.xlsx)</p>
                            <p>3.上传文件大小限制：5MB，若要上传大文件，请联系系统管理员</p>
                            <p>4.Excel文档格式要求：请下载并参考<a href="ExcelTemplate/考试信息批量录入模版.xlsx">考试信息批量录入模版.xlsx</a>、<a href="ExcelTemplate/考题信息录入模版.xlsx">考题信息录入模版.xlsx</a></p>
                        </div>
                    </Content>
                    <BottomBar>
                        <ext:StatusBar runat="server">
                            <Items>
                                <ext:Button Text="高级管理" runat="server">
                                    <Listeners>
                                        <Click Handler="#{ManageExamWindow}.show()" />
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:StatusBar>
                    </BottomBar>
                </ext:Panel>
            </td>
        </tr>
    </table>
    <ext:Window ID="ManageExamWindow" Icon="Application" Title="高级管理"
        Height="340" BodyPadding="5" runat="server" Layout="HBoxLayout"
        Width="1025" Modal="true" Hidden="true">
        <Items>
            <ext:GridPanel Width="250" Height="300" runat="server" ID="GridPanel1" Title="考试组"
                Frame="true">
                <Store>
                    <ext:Store ID="Store1" runat="server" OnBeforeStoreChanged="Store1_BeforeChange">
                        <Model>
                            <ext:Model ID="Model1" runat="server" IDProperty="ExamGroupID">
                                <Fields>
                                    <ext:ModelField Name="ExamGroupID" />
                                    <ext:ModelField Name="GroupName" />
                                </Fields>
                            </ext:Model>
                        </Model>
                        <Listeners>
                            <Write Handler="Ext.Msg.alert('提示', '考试组信息变更成功！');" />
                        </Listeners>
                    </ext:Store>
                </Store>
                <Plugins>
                    <ext:CellEditing ID="CellEditing1" runat="server" />
                </Plugins>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:Column ID="Column2" Width="230" runat="server" DataIndex="GroupName" HideTitleEl="true">
                            <Editor>
                                <ext:TextField ID="TextField2" runat="server" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <View>
                    <ext:GridView ID="GridView1" runat="server">
                        <GetRowClass Handler="return 'x-grid-row-expanded';" />
                    </ext:GridView>
                </View>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" Mode="Single">
                        <Listeners>
                            <Select Handler="#{btnDelete}.enable();" />
                            <Deselect Handler="if (!#{GridPanel1}.selModel.hasSelection()) {
                                                        #{btnDelete}.disable();
                                                    }" />
                        </Listeners>
                        <DirectEvents>
                            <Select OnEvent="RowSelect" Buffer="250">
                                <ExtraParams>
                                    <ext:Parameter Name="ExamGroupID" Value="record.getId()" Mode="Raw" />
                                </ExtraParams>
                            </Select>
                        </DirectEvents>
                    </ext:RowSelectionModel>
                </SelectionModel>
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button ID="Button1" runat="server" Icon="Add" Text="">
                                <Listeners>
                                    <Click Handler="#{Store1}.insert(0, {}); #{GridPanel1}.editingPlugin.startEditByPosition({row:0, column:0});" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="btnDelete" runat="server" Icon="Delete" Text="" Disabled="true">
                                <Listeners>
                                    <Click Handler="#{GridPanel1}.deleteSelected();
                                                    if (!#{GridPanel1}.hasSelection()) {
                                                        #{btnDelete}.disable();
                                                    }" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button2" runat="server" Icon="Disk" Text="">
                                <Listeners>
                                    <Click Handler="#{Store1}.sync();" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button3" runat="server" Icon="Cancel" Text="">
                                <Listeners>
                                    <Click Handler="#{GridPanel1}.getSelectionModel().deselectAll();;
                                                    if (!#{GridPanel1}.hasSelection()) {
                                                        #{btnDelete}.disable();
                                                    }" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button4" runat="server" Icon="ArrowRefresh">
                                <Listeners>
                                    <Click Handler="#{Store1}.load();" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
            </ext:GridPanel>
            <ext:GridPanel ID="GridPanel2" Width="250" Height="300" Frame="true" runat="server"
                Title="组内考试">
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel3" runat="server" Mode="Single" />
                </SelectionModel>
                <Store>
                    <ext:Store ID="Store2" runat="server">
                        <Model>
                            <ext:Model ID="Model2" runat="server" IDProperty="ExamID">
                                <Fields>
                                    <ext:ModelField Name="ExamName" />
                                    <ext:ModelField Name="ExamID" />
                                    <ext:ModelField Name="ExamGroupID" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel2" runat="server">
                    <Columns>
                        <ext:Column ID="Column3" runat="server" HideTitleEl="true"  Width="230" DataIndex="ExamName" />
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
            <ext:GridPanel ID="GridPanel3" Region="West" runat="server" Title="所有考试" Width="250"
                Height="300" Frame="true">
                <Store>
                    <ext:Store ID="Store3" runat="server" OnBeforeStoreChanged="Store3_BeforeChange">
                        <Model>
                            <ext:Model ID="Model3" runat="server" IDProperty="ExamID">
                                <Fields>
                                    <ext:ModelField Name="ExamID" />
                                    <ext:ModelField Name="ExamName" />
                                </Fields>
                            </ext:Model>
                        </Model>
                        <Listeners>
                            <Write Handler="Ext.Msg.alert('提示', '考试信息变更成功！');" />
                        </Listeners>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel3" runat="server">
                    <Columns>
                        <ext:Column ID="Column1" Flex="1" runat="server" HideTitleEl="true" DataIndex="ExamName"
                            Width="230">
                            <Editor>
                                <ext:TextField ID="TextField1" runat="server" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single">
                        <Listeners>
                            <Select Handler="#{Button10}.enable();" />
                            <Deselect Handler="if (!#{GridPanel3}.selModel.hasSelection()) {
                                                       #{Button10}.disable();
                                                   }" />
                        </Listeners>
                        <DirectEvents>
                            <Select OnEvent="RowSelect_ExamInfo" Buffer="250">
                                <ExtraParams>
                                    <ext:Parameter Name="ExamID" Value="record.getId()" Mode="Raw" />
                                </ExtraParams>
                            </Select>
                        </DirectEvents>
                    </ext:RowSelectionModel>
                </SelectionModel>
                <Plugins>
                    <ext:CellEditing ID="CellEditing2" runat="server" />
                </Plugins>
                <BottomBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button ID="Button5" runat="server" Icon="ResultsetNext" StyleSpec="margin-bottom:2px;"
                                OnDirectClick="Button5_DirectClick">
                            </ext:Button>
                            <ext:Button ID="Button6" runat="server" Icon="ResultsetLast" StyleSpec="margin-bottom:2px;"
                                OnDirectClick="Button6_DirectClick">
                            </ext:Button>
                            <ext:Button ID="Button7" runat="server" Icon="ResultsetPrevious" StyleSpec="margin-bottom:2px;"
                                OnDirectClick="Button7_DirectClick">
                            </ext:Button>
                            <ext:Button ID="Button8" runat="server" Icon="ResultsetFirst" StyleSpec="margin-bottom:2px;"
                                OnDirectClick="Button8_DirectClick">
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </BottomBar>
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button ID="Button9" runat="server" Icon="Add" Text="">
                                <Listeners>
                                    <Click Handler="#{Store3}.insert(0, {}); #{GridPanel3}.editingPlugin.startEditByPosition({row:0, column:0});" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button10" runat="server" Icon="Delete" Text="" Disabled="true">
                                <Listeners>
                                    <Click Handler="#{GridPanel3}.deleteSelected();
                                                    if (!#{GridPanel3}.hasSelection()) {
                                                        #{Button10}.disable();
                                                    }" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button11" runat="server" Icon="Disk" Text="">
                                <Listeners>
                                    <Click Handler="#{Store3}.sync();" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button12" runat="server" Icon="Cancel" Text="">
                                <Listeners>
                                    <Click Handler="#{GridPanel3}.getSelectionModel().deselectAll();;
                                                    if (!#{GridPanel3}.hasSelection()) {
                                                        #{Button10}.disable();
                                                    }" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button13" runat="server" Icon="ArrowRefresh">
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
            </ext:GridPanel>
            <ext:GridPanel ID="GridPanel_ItemGroup" Region="West" runat="server" Title="试题组"
                Width="250" Height="300" Frame="true">
                <Store>
                    <ext:Store ID="Store4" runat="server" OnBeforeStoreChanged="Store4_BeforeChange">
                        <Model>
                            <ext:Model ID="Model4" runat="server" IDProperty="ExamItemGroupID">
                                <Fields>
                                    <ext:ModelField Name="ExamItemGroupID" />
                                    <ext:ModelField Name="GroupName" />
                                </Fields>
                            </ext:Model>
                        </Model>
                        <Listeners>
                            <Write Handler="Ext.Msg.alert('提示', '试题组信息变更成功！');" />
                        </Listeners>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel4" runat="server">
                    <Columns>
                        <ext:Column ID="Column4" Flex="1" runat="server" HideTitleEl="true"  DataIndex="GroupName"
                            Width="290">
                            <Editor>
                                <ext:TextField ID="TextField3" runat="server" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel4" runat="server" Mode="Single">
                        <Listeners>
                            <Select Handler="#{Button15}.enable();" />
                            <Deselect Handler="if (!#{GridPanel_ItemGroup}.selModel.hasSelection()) {
                                                       #{Button15}.disable();
                                                   }" />
                        </Listeners>
                        <DirectEvents>
                            <Select Buffer="250">
                                <ExtraParams>
                                    <ext:Parameter Name="ExamItemGroupID" Value="record.getId()" Mode="Raw" />
                                </ExtraParams>
                            </Select>
                        </DirectEvents>
                    </ext:RowSelectionModel>
                </SelectionModel>
                <Plugins>
                    <ext:CellEditing ID="CellEditing3" runat="server" />
                </Plugins>
                <BottomBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button ID="Button14" runat="server" Icon="Add" Text="">
                                <Listeners>
                                    <Click Handler="#{Store4}.insert(0, {}); #{GridPanel_ItemGroup}.editingPlugin.startEditByPosition({row:0, column:0});" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button15" runat="server" Icon="Delete" Text="" Disabled="true">
                                <Listeners>
                                    <Click Handler="#{GridPanel_ItemGroup}.deleteSelected();
                                                    if (!#{GridPanel_ItemGroup}.hasSelection()) {
                                                        #{Button15}.disable();
                                                    }" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button16" runat="server" Icon="Disk" Text="">
                                <Listeners>
                                    <Click Handler="#{Store4}.sync();" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button17" runat="server" Icon="Cancel" Text="">
                                <Listeners>
                                    <Click Handler="#{GridPanel_ItemGroup}.getSelectionModel().deselectAll();;
                                                    if (!#{GridPanel_ItemGroup}.hasSelection()) {
                                                        #{Button15}.disable();
                                                    }" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button18" runat="server" Icon="ArrowRefresh">
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </BottomBar>
            </ext:GridPanel>
        </Items>
    </ext:Window>
</asp:Content>
